/*
 * Copyright 2006-2008 Michele Mostarda ( michele.mostarda@gmail.com ).
 * All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package org.graphnav.model;

import org.graphnav.swing.Arc;
import org.graphnav.swing.Node;

import java.util.Collections;
import java.util.List;

/**
 * Contains a set of nodes and arcs that has been excluded during the application of a filter
 * by a <code>FilteredGraphModel</code>.
 *
 * @see org.graphnav.model.FilteredGraphModel
 * @see org.graphnav.model.Filter
 */
public class Excluded {

    public static final Excluded EMPTY = new Excluded(Collections.emptyList(), Collections.emptyList());

    /**
     * List of exclueded nodes.
     */
    private List nodes;

    /**
     * List of excluded arcs.
     */
    private List arcs;

    /**
     * Constructor.
     *
     * @param nodes
     * @param arcs
     */
    protected Excluded(List nodes, List arcs) {
        this.nodes = nodes;
        this.arcs  = arcs;
    }

    /**
     * Returns the list of the excluded nodes.
     *
     * @return
     */
    public List excludedNodes() {
        return nodes;
    }

    /**
     * Returns the list of the excluded arcs.
     *
     * @return
     */
    public List excludedArcs() {
        return arcs;
    }

    /**
     * Returns the number of the excluded nodes.
     *
     * @return a non negative value.
     */
    public int excludedNodesCount() {
        return nodes.size();
    }

    /**
     * Retuns the number of the excluded arcs.
     *
     * @return
     */
    public int excludedArcsCount() {
        return arcs.size();
    }

    /**
     * Returns the i-th excluded node.
     *
     * @param i positional index of the node.
     * @return a <code>Node</code> object
     */
    public Node getExcludedNode(int i) {
        return (Node) nodes.get(i);
    }

    /**
     * Returns the i-th excluded arc.
     *
     * @param i the -th excluded arc.
     * @return a <code>Node</code> object
     */
    public Arc getExcludedArc(int i) {
        return (Arc) arcs.get(i);
    }

}
